package com.imooc.ecommerce.controller;

import com.imooc.ecommerce.stream.DefaultSendService;
import com.imooc.ecommerce.stream.qinyi.QinyiSendService;
import com.imooc.ecommerce.vo.QinyiMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 构建消息驱动
 * @author zhangshao
 * @since 2023/12/10 23:18
 */
@Slf4j
@RestController
@RequestMapping("/message")
public class MessageController {

    @Autowired
    private DefaultSendService defaultSendService;

    @Autowired
    private QinyiSendService qinyiSendService;

    /**
     * 默认信道
     */
    @GetMapping("/default")
    public void defaultSend(){
        defaultSendService.sendMessage(QinyiMessage.defaultMessage());
    }

    /**
     * 自定义信道
     */
    @GetMapping("/qinyi")
    public void qinyiSend(){
        qinyiSendService.sendMessage(QinyiMessage.defaultMessage());
    }
}
